package com.applications.codemash.core;

import com.applications.codemash.groupers.SessionKeyForDifficulty;

import android.app.Activity;
import android.app.ProgressDialog;

public abstract class BaseActivity extends Activity
{
	private ProgressDialog _progressDialog;
	private IGetKey _generator = new SessionKeyForDifficulty();
	
	protected void setGenerator(IGetKey keyGen) { _generator = keyGen; }
	public IGetKey getGenerator() { return _generator; }
	
	private void setWindowTitle(String keyName)
	{
		String newTitle = keyName + " Sessions";
		setTitle(newTitle);
	}
	
	public void setWindowTitle(Session session)
	{
		String key = getGenerator().getKey(session);
		setWindowTitle(key);
	}
	
	public void showProgressDialog(String title, String message)
	{
		_progressDialog = ProgressDialog.show(this, title, message);
	}
	
	public void hideProgresDialog()
	{
		_progressDialog.dismiss();
	}
}
